package org.budo.filestore.local;

import org.budo.filestore.impl.AbstractFileStore;

import lombok.Getter;
import lombok.Setter;

/**
 * @author lmw
 */
@Getter
@Setter
public abstract class AbstractLocalFileStore extends AbstractFileStore {
    private String rootPath;

    private String downloadUrlPrefix;

    /**
     * 最大文件数量，如果超出则会删除最老的文件
     */
    private Integer maxFileCount = -1;

    protected String rootPath() {
        if (null == this.getRootPath() || this.getRootPath().isEmpty()) {
            throw new IllegalArgumentException("#22 rootPath can not be empty, this=" + this);
        }

        return this.getRootPath();
    }

    @Override
    public String toString() {
        return super.toString() //
                + ", rootPath=" + this.getRootPath() //
                + ", maxFileCount=" + this.getMaxFileCount();
    }
}